:root,
:host {
  --van-image-preview-index-text-color: var(--van-white);
  --van-image-preview-index-font-size: var(--van-font-size-md);
  --van-image-preview-index-line-height: var(--van-line-height-md);
  --van-image-preview-index-text-shadow: 0 1px 1px var(--van-gray-8);
  --van-image-preview-overlay-background: rgba(0, 0, 0, 0.9);
  --van-image-preview-close-icon-size: 22px;
  --van-image-preview-close-icon-color: var(--van-gray-5);
  --van-image-preview-close-icon-margin: var(--van-padding-md);
  --van-image-preview-close-icon-z-index: 1;
}

.van-image-preview {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  background-color: transparent;
  transform: none;

  &__swipe {
    height: 100%;

    &-item {
      display: flex;
      align-items: center;
      justify-content: center;
      overflow: hidden;
    }
  }

  &__cover {
    position: absolute;
    top: 0;
    left: 0;
  }

  &__image,
  &__image-wrap {
    width: 100%;
    transition-property: transform;

    &--vertical {
      width: auto;
      height: 100%;
    }

    img,
    video {
      // disable desktop browser image drag
      -webkit-user-drag: none;
    }

    .van-image {
      &__error {
        top: 30%;
        height: 40%;
      }

      &__error-icon {
        font-size: 36px;
      }

      &__loading {
        background-color: transparent;
      }
    }
  }

  &__index {
    position: absolute;
    top: var(--van-padding-md);
    left: 50%;
    color: var(--van-image-preview-index-text-color);
    font-size: var(--van-image-preview-index-font-size);
    line-height: var(--van-image-preview-index-line-height);
    text-shadow: var(--van-image-preview-index-text-shadow);
    transform: translate(-50%, 0);
  }

  &__overlay {
    background: var(--van-image-preview-overlay-background);
  }

  &__close-icon {
    position: absolute;
    z-index: var(--van-image-preview-close-icon-z-index);
    color: var(--van-image-preview-close-icon-color);
    font-size: var(--van-image-preview-close-icon-size);

    &--top-left {
      top: var(--van-image-preview-close-icon-margin);
      left: var(--van-image-preview-close-icon-margin);
    }

    &--top-right {
      top: var(--van-image-preview-close-icon-margin);
      right: var(--van-image-preview-close-icon-margin);
    }

    &--bottom-left {
      bottom: var(--van-image-preview-close-icon-margin);
      left: var(--van-image-preview-close-icon-margin);
    }

    &--bottom-right {
      right: var(--van-image-preview-close-icon-margin);
      bottom: var(--van-image-preview-close-icon-margin);
    }
  }
}
